FROM openshift/base-centos7

VOLUME /work
WORKDIR /work
COPY ./pkg /work


RUN tar xvf jdk1.8.0_181.tar.gz -C /usr/local/share && \
    tar -xzf apache-maven-3.6.1-bin.tar.gz -C /usr/local/share && \
    tar -xzf hadoop-3.0.3.tar.gz -C /usr/local/share && \
    tar -xzf apache-hive-3.1.2-bin.tar.gz -C /usr/local/share && \
    tar -xzf zookeeper-3.4.5.tar.gz -C /usr/local/share && \
    tar -xzf hbase-2.2.4-bin.tar.gz -C /usr/local/share && \
    tar -xzf scala-2.11.12.tgz -C /usr/local/share && \
    tar -xzf spark-2.4.5-bin-without-hadoop.tgz -C /usr/local/share && \
    tar -xzf kafka_2.11-2.4.1.tgz -C /usr/local/share && \
    tar -xzf apache-kylin-3.0.1-bin-hadoop3.tar.gz -C /usr/local/share && \
    cp spark-streaming-kafka-*.jar /usr/local/share/spark-2.4.5-bin-without-hadoop/jars && \
    curl https://bintray.com/sbt/rpm/rpm | tee /etc/yum.repos.d/bintray-sbt-rpm.repo && \    
    yum -y update && \
    yum -y groupinstall "Development tools" && \
    yum -y install sbt passwd openssh-clients openssh-server pdsh pdsh-rcmd-ssh pdsh-rcmd-rsh expect && \
    yum clean all && \
    sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
    sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd && \
    echo "export JAVA_HOME=/usr/local/share/jdk1.8.0_181" >> /root/.bashrc && \
    echo "export JAVA_BIN=/usr/local/share/jdk1.8.0_181/bin" >> /root/.bashrc && \
    echo "export JAVA_LIB=/usr/local/share/jdk1.8.0_181/lib" >> /root/.bashrc && \
    echo "export CLASSPATH=$CLASSPATH:/usr/local/share/jdk1.8.0_181/lib/tools.jar:/usr/local/share/jdk1.8.0_181/lib/dt.jar" >> /root/.bashrc && \
    echo "export HADOOP_HOME=/usr/local/share/hadoop-3.0.3" >> /root/.bashrc && \
    echo "export MAVEN_HOME=/usr/local/share/apache-maven-3.6.1" >> /root/.bashrc && \
    echo "export HIVE_HOME=/usr/local/share/apache-hive-3.1.2-bin" >> /root/.bashrc && \
    echo "export ZK_HOME=/usr/local/share/zookeeper-3.4.5" >> /root/.bashrc && \
    echo "export HBASE_HOME=/usr/local/share/hbase-2.2.4" >> /root/.bashrc && \
    echo "export SCALA_HOME=/usr/local/share/scala-2.11.12" >> /root/.bashrc && \
    echo "export SPARK_HOME=/usr/local/share/spark-2.4.5-bin-without-hadoop" >> /root/.bashrc && \
    echo "export KAFKA_HOME=/usr/local/share/kafka_2.11-2.4.1" >> /root/.bashrc && \
    echo "export HADOOP_HDFS_HOME=/usr/local/share/hadoop-3.0.3" >> /root/.bashrc && \
    echo "export HADOOP_MAPRED_HOME=/usr/local/share/hadoop-3.0.3" >> /root/.bashrc && \
    echo "export HADOOP_COMMON_HOME=/usr/local/share/hadoop-3.0.3" >> /root/.bashrc && \
    echo "export HADOOP_COMMON_LIB_NATIVE_DIR=/usr/local/share/hadoop-3.0.3/lib/native" >> /root/.bashrc && \
    echo "export KYLIN_HOME=/usr/local/share/apache-kylin-3.0.1-bin-hadoop3" >> /root/.bashrc && \
    echo "export PATH=$HOME/.local/bin/:$PATH:/usr/local/share/jdk1.8.0_181/bin:/usr/local/share/scala-2.11.12/bin:/usr/local/share/spark-2.4.5-bin-without-hadoop/bin:/usr/local/share/spark-2.4.5-bin-without-hadoop/sbin:/usr/local/share/kafka_2.11-2.4.1/bin:/usr/local/share/hadoop-3.0.3/bin:/usr/local/share/hadoop-3.0.3/sbin:/usr/local/share/apache-maven-3.6.1/bin:/usr/local/share/apache-hive-3.1.2-bin/bin:/usr/local/share/zookeeper-3.4.5/bin:/usr/local/share/hbase-2.2.4/bin:/usr/local/share/scala-2.11.12/bin:/usr/local/share/spark-2.4.5-bin-without-hadoop/bin:/usr/local/share/kafka_2.11-2.4.1/bin:/usr/local/share/apache-kylin-3.0.1-bin-hadoop3/bin" >> /root/.bashrc

ENV JAVA_HOME=/usr/local/share/jdk1.8.0_181 \
    JAVA_BIN=/usr/local/share/jdk1.8.0_181/bin \
    JAVA_LIB=/usr/local/share/jdk1.8.0_181/lib \
    CLASSPATH=$CLASSPATH:/usr/local/share/jdk1.8.0_181/lib/tools.jar:/usr/local/share/jdk1.8.0_181/lib/dt.jar \
    HADOOP_HOME=/usr/local/share/hadoop-3.0.3 \
    MAVEN_HOME=/usr/local/share/apache-maven-3.6.1 \
    HIVE_HOME=/usr/local/share/apache-hive-3.1.2-bin \
    ZK_HOME=/usr/local/share/zookeeper-3.4.5 \
    HBASE_HOME=/usr/local/share/hbase-2.2.4 \
    SCALA_HOME=/usr/local/share/scala-2.11.12 \
    SPARK_HOME=/usr/local/share/spark-2.4.5-bin-without-hadoop \    
    KAFKA_HOME=/usr/local/share/kafka_2.11-2.4.1 \
    HADOOP_HDFS_HOME=/usr/local/share/hadoop-3.0.3 \
    HADOOP_MAPRED_HOME=/usr/local/share/hadoop-3.0.3 \
    HADOOP_COMMON_HOME=/usr/local/share/hadoop-3.0.3 \
    HADOOP_COMMON_LIB_NATIVE_DIR=/usr/local/share/hadoop-3.0.3/lib/native \
    KYLIN_HOME=/usr/local/share/apache-kylin-3.0.1-bin-hadoop3 \
    PATH=$HOME/.local/bin/:$PATH:/usr/local/share/jdk1.8.0_181/bin:/usr/local/share/scala-2.11.12/bin:/usr/local/share/spark-2.4.5-bin-without-hadoop/bin:/usr/local/share/kafka_2.11-2.4.1/bin:/usr/local/share/spark-2.4.5-bin-without-hadoop/sbin:/usr/local/share/hadoop-3.0.3/bin:/usr/local/share/hadoop-3.0.3/sbin:/usr/local/share/apache-maven-3.6.1/bin:/usr/local/share/apache-hive-3.1.2-bin/bin:/usr/local/share/zookeeper-3.4.5/bin:/usr/local/share/hbase-2.2.4/bin:/usr/local/share/scala-2.11.12/bin:/usr/local/share/spark-2.4.5-bin-without-hadoop/bin:/usr/local/share/kafka_2.11-2.4.1/bin:/usr/local/share/apache-kylin-3.0.1-bin-hadoop3/bin \
    # LC_ALL=en_us.UTF-8 \
    LC_CTYPE=en_us \
    LANG=en_us.UTF-8


EXPOSE 7070
EXPOSE 8088
EXPOSE 50070
EXPOSE 8032
EXPOSE 8042
EXPOSE 16010
EXPOSE 18080


# CMD bash start_kylin.sh
CMD bash
